﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DBDataAccessLib.DataMapping;

namespace UserControlLib
{
    /// <summary>
    /// Interaction logic for MachineInfoControl.xaml
    /// </summary>
    public partial class MachineInfoControl : UserControl
    {
        public MachineInfoControl()
        {
            InitializeComponent();
            this.DataContext = new MachineInfoControlViewModel();

            Binding binding = new Binding("IsEditMode");
            binding.Source = this.DataContext;
            binding.Mode = BindingMode.OneWayToSource;
            this.SetBinding(MachineInfoControl.IsEditModeProperty, binding);

            Binding binding2 = new Binding("MachineInfo");
            binding2.Source = this.DataContext;
            binding2.Mode = BindingMode.OneWayToSource;
            this.SetBinding(MachineInfoControl.MachineInfoProperty, binding2);
        }



        public bool IsEditMode
        {
            get { return (bool)GetValue(IsEditModeProperty); }
            set { SetValue(IsEditModeProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IsEditMode.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsEditModeProperty =
            DependencyProperty.Register("IsEditMode", typeof(bool), typeof(MachineInfoControl), new UIPropertyMetadata(false));




        public MachineInfoRecordMapping MachineInfo
        {
            get { return (MachineInfoRecordMapping)GetValue(MachineInfoProperty); }
            set { SetValue(MachineInfoProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MachineInfo.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MachineInfoProperty =
            DependencyProperty.Register("MachineInfo", typeof(MachineInfoRecordMapping), typeof(MachineInfoControl), new UIPropertyMetadata(null));


    }
}
